<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>发表评价</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/CSS.css">
    <script src="../js/jquery-3.3.1.js"></script>
    <script src="../layui/layui.all.js"></script>
    <script src="../layui/layui.js"></script>
    <script src="../js/JS.js"></script>
</head>
<body>
<header>
    <a href="javascript:history.back(-1)" class="back"><img src="../img/back.png" height="18px"></a>
    <div class="center title">发表评价</div>
</header>
<div class="apponitment">
    <ul class="clearfix" style="width: 60%;margin: 0 auto">
        <li class=""><img src="../img/logo.png" style="width: 67px;height: 67px" alt=""></li>
        <li class="">
            星级评分:<p class="score"></p>
        </li>
        <li class="" style="text-align: center"><input type="button" value="提交" class="apponitment_btn" style="display: inline-block;margin: 0;padding: 1% 2%; background: #58d5f4;border: none;
    color: #fff;"></li>
    </ul>
</div>
</body>
</html>
<script>
     function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
        //接收URL中的参数id
        var id = getUrlParam('id');
        console.log(id);
    var uImg = localStorage.getItem("uImg");
    $('.head img').attr('src',uImg);
    layui.use(['rate'], function(){
        var rate = layui.rate;
        rate.render({
            elem: '.score',
            value:0,
            half: false,
            text: true,
            readonly: false,
            setText: function(value){
                this.span.text(value+'分');
            }
        });

    });
      $('.apponitment_btn').click(function () {
        var val=$('.score span').text();
        var score=val.substring(0,val.length-1);
        console.log(score);
        $.post('/meiyou/lyPingxing',{tAssess:score,tId:id},function(data){
            console.log(data);
        })
    })
</script>
